// 云函数入口文件
const cloud = require('wx-server-sdk')
const insert = require('./insert/index')
const update = require('./update/index')
const query = require('./query/index')
const del = require('./delete/index')

cloud.init({
    env: cloud.DYNAMIC_CURRENT_ENV
})
const db = cloud.database()

// 云函数入口函数
exports.main = async (event, context) => {
    switch(event.type) {
        case 'insert':
            return await insert.main(event, context)
        case 'update':
            return await update.main(event, context)
        case 'query':
            return await query.main(event, context)
        case 'delete':
            return await del.main(event, context)
        default:
            return
    }
}